<?php

declare(strict_types=1);

namespace App\CustHub\Mapper;

use App\CustHub\Model\ChSeatOrder;
use Mine\Abstracts\AbstractMapper;
use Mine\MineModel;


class ChGetSeatOrderMapper extends AbstractMapper
{
    public function assignModel()
    {
        $this->model = ChSeatOrder::class;
    }


    public function getSeatOrder($params)
    {
        $filters = [
            'uid' => '=',
            'order_no' => '=',
            'seat_type' => '=',
            'status' => '=',
        ];
         $query = $this->model::query()
            ->select(['id','uid','order_no','total_amount','discount','pay_amount','pay_way','seat_type',
            'status','pay_time','created_at'])
            ->orderBy('id','DESC');
         $query = applyFilters($query, $params,$filters);
        $paginate = $query->paginate((int)$params['pageSize']??MineModel::PAGE_SIZE);

         return $this->setPaginate($paginate);
    }
}
